import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '巡检人',
    align: 'center',
    dataIndex: 'createBy',
  },
  {
    title: '巡检时间',
    align: 'center',
    dataIndex: 'createTime',
  },
  {
    title: '所属区域',
    align: 'center',
    dataIndex: 'regionCode_dictText',
  },
  {
    title: '状态',
    align: 'center',
    dataIndex: 'status',
  },
  {
    title: '使用单位',
    align: 'center',
    dataIndex: 'inspectionUnit',
  },
  {
    title: '器具名称',
    align: 'center',
    dataIndex: 'deviceName',
  },
  {
    title: '规格型号',
    align: 'center',
    dataIndex: 'deviceType',
  },
  {
    title: '出厂编号',
    align: 'center',
    dataIndex: 'deviceInitCode',
  },
  {
    title: '制造厂商',
    align: 'center',
    dataIndex: 'madeInCompany',
  },
  {
    title: '安装位置',
    align: 'center',
    dataIndex: 'deviceAddress',
  },
  {
    title: '设备ID',
    align: 'center',
    dataIndex: 'deviceId',
    width: 180,
  },
  {
    title: '子设备编码',
    align: 'center',
    dataIndex: 'deviceCode',
  },
  {
    title: '铅封ID',
    align: 'center',
    dataIndex: 'sealLeadId',
  },
  {
    title: '施封位置',
    align: 'center',
    dataIndex: 'positionText',
  },
  {
    title: '行政区域',
    align: 'center',
    dataIndex: 'regionCode_dictText',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '巡检人',
    field: 'createBy',
    component: 'Input',
  },
  {
    label: '巡检时间',
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss',
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'Input',
  },
  {
    label: '使用单位',
    field: 'inspectionUnit',
    component: 'Input',
  },
  {
    label: '器具名称',
    field: 'deviceName',
    component: 'Input',
  },
  {
    label: '规格型号',
    field: 'deviceType',
    component: 'Input',
  },
  {
    label: '出厂编号',
    field: 'deviceInitCode',
    component: 'Input',
  },
  {
    label: '制造厂商',
    field: 'madeInCompany',
    component: 'Input',
  },
  {
    label: '安装位置',
    field: 'deviceAddress',
    component: 'Input',
  },
  {
    label: '设备ID',
    field: 'deviceId',
    component: 'Input',
  },
  {
    label: '子设备编码',
    field: 'deviceCode',
    component: 'Input',
  },
  {
    label: '铅封ID',
    field: 'sealLeadId',
    component: 'Input',
  },
  {
    label: '施封位置',
    field: 'positionText',
    component: 'Input',
  },
  {
    label: '行政区域',
    field: 'regionCode',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'xi_an_region_code',
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  createBy: { title: '巡检人', order: 0, view: 'text', type: 'string' },
  createTime: { title: '巡检时间', order: 1, view: 'datetime', type: 'string' },
  status: { title: '状态', order: 2, view: 'text', type: 'string' },
  inspectionUnit: { title: '使用单位', order: 3, view: 'text', type: 'string' },
  deviceName: { title: '器具名称', order: 4, view: 'text', type: 'string' },
  deviceType: { title: '规格型号', order: 5, view: 'text', type: 'string' },
  deviceInitCode: { title: '出厂编号', order: 6, view: 'text', type: 'string' },
  madeInCompany: { title: '制造厂商', order: 7, view: 'text', type: 'string' },
  deviceAddress: { title: '安装位置', order: 8, view: 'text', type: 'string' },
  deviceId: { title: '设备ID', order: 9, view: 'text', type: 'string' },
  deviceCode: { title: '子设备编码', order: 10, view: 'text', type: 'string' },
  sealLeadId: { title: '铅封ID', order: 11, view: 'text', type: 'string' },
  positionText: { title: '施封位置', order: 12, view: 'text', type: 'string' },
  regionCode: { title: '行政区域', order: 13, view: 'list', type: 'string', dictCode: 'xi_an_region_code' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
